package gtkwire.widget.cairo;

import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;

/**
* <code>CairoGraphics</code> is a handle object for a Cairo graphics context that has been created by the platform and waits draw commands.
* <h2> Drawing with Cairo</h2>
* Drawing with Cairo is done by repeating approximately the following process as many times as needed.
* <ol>
* <li> Create path and clip it.
* <li> Set source.
* <li> Set context attributes.
* <li> Do a draw operation.
* </ol>
* <h3> Code example</h3>
* Following code draws a box with a hole in it with green fill and black outline.
* <p>
* <blockquote><pre>
* public void exposureEvent( CairoGraphics g )
* {
*	// line width
*	g.set_line_width( 6 );
*
*	// box path
*	g.rectangle( 0, 0, 64, 64 );
*
*	// hole path
*	g.new_sub_path(); 
*	g.arc ( 64, 64, 40, 0, 2*Math.PI);
*
*	// fill
*	g.set_fill_rule( FILL_RULE_EVEN_ODD );
*	g.set_source_rgb( 0, 0.7, 0 ); 
*	g.fill_preserve();
*
*	// draw outline
*	g.set_source_rgb( 0, 0, 0);
	g.stroke ();
* }
* </pre></blockquote>
* <p>
* <h2> Concepts </h2>
* Understanding following concepts that are present in method names and documentation helps using <code> CairoGraphics</code>.
* <h3> Cairo Context and its attributes </h3>
* <dl compact>
* <dt><i><code>Context</code></i>
* <dd>Context keeps track of everything. It tracks one source, one destination, and one mask.
* It also tracks several helper variables like your line width and style.
* Most importantly context tracks the path, which is turned into a mask by drawing methods.
* <p>
* In this binding the context is created by native code before CairoGraphics is provided to be manipulated. 
* All method calls then affect the context that is stored on the native side of library. It is therefore
* quite correct to think of CairoGraphics object as a cairo graphics context.
* <dt><i><code>Destination</code></i>
* <dd>Destination is the surface on which you are drawing. It may be tied to a GtkWidget display area, image bitmap in memory, or a SVG or PDF file.
* Currently only cairo destination available in this binding is a GtkDrawable display area.
* <p>
* <dt><i><code>Source</code></i>
* <dd>Source is the "paint" shapes are drawn with. Unlike real paint, it doesn't have to be a single color and it can contain transparency information.
* <p> 
* <dt><i><code>Mask</code></i> 
* <dd> Mask controls where you apply the source to the destination. When you call a drawing method, 
* it's like you stamp the source to the destination.
* Anywhere the mask allows, the source is copied. Anywhere the mask disallows, nothing happens. 
* Mask is created using a combination of path and clip operations.
* <p>
* <dt><i><code>Path</code></i> 
* <dd> Path is a description of a line shape. It is a closed or open list of lines and curves. It is converted to a 
* mask and consumed when a drawing method is called.
* <p>
* <dt><i><code>Clip</code></i> 
* <dd>Clip reduces the area that will be affected by draw operations. Clips are created by setting path and then clipping. 
* Unlike paths clips are not consumed by draw operations and have to be cleared explicitly.
*<p>
* </dl>
* <h3> Drawing operations </h3>
* <p>
* <dl compact>
* <dt><i><code>Stroke</code></i> 
* <dd> Stroke operation takes a virtual pen along the path. It allows the source to transfer 
* through the mask in a thin (or thick) line around the path, according to the pen's line width, dash style, and line caps.
*<p> 
* <dt><i><code>Fill</code></i> 
* <dd> Fill operation instead uses the path like the lines of a coloring book, 
* and allows the source through the mask within the hole whose boundaries are the path. 
* For complex paths (paths with multiple closed sub-paths, like a donut, or paths 
* that self-intersect) this is influenced by the fill rule. 
* Note that while stroking the path transfers the source for half of the 
* line width on each side of the path, filling a path fills directly up to the edge of the path and no further.
* <p>
* <dt><i><code>Paint</code></i> 
* <dd> Paint operation uses a mask that transfers the entire source to the destination. 
* Some people consider this an infinitely large mask, and others consider it no mask.
* <p>
* <dt><i><code>Mask</code></i> 
* <dd> Mask operation allows transfer according to the transparency/opacity of a second source pattern or surface. 
* Where the pattern or surface is opaque, the current source is transferred to the destination. 
* Where the pattern or surface is transparent, nothing is transferred.
* </dl>
* <p>
* Most method namess in CairoGraphics correspond directly to a subset of Cairo API methods names. Add prefix cairo_ to method name 
* to get the corresponding C methods name.
*
* {@link set_source_rgb( CairoColor c )}
*/
public class CairoGraphics
{
	//------------------------------------------------ COMPOSITION OPERATOR
	/**
	* Clear destination layer (bounded).
	*/
	public static final int OPERATOR_CLEAR = 0;
	/**
	* Replace destination layer (bounded).
	*/
	public static final int OPERATOR_SOURCE = 1;
	/**
	* Draw source layer on top of destination layer (bounded).
	*/
	public static final int OPERATOR_OVER = 2;
	/**
	* Draw source where there was destination content (unbounded).
	*/
	public static final int OPERATOR_IN = 3;
	/**
	* Draw source where there was no destination content (unbounded).
	*/
	public static final int OPERATOR_OUT = 4;
	/**
	* Draw source on top of destination content and only there.
	*/
	public static final int OPERATOR_ATOP = 5;
	/**
	* Ignore the source.
	*/
	public static final int OPERATOR_DEST = 6;
	/**
	* Draw destination on top of source.
	*/
	public static final int OPERATOR_DEST_OVER = 7;
	/**
	* Leave destination only where there was source content (unbounded).
	*/
	public static final int OPERATOR_DEST_IN = 8;
	/**
	* Leave destination only where there was no source content.
	*/
	public static final int OPERATOR_DEST_OUT = 9;
	/**
	* Leave destination on top of source content and only there (unbounded).
	*/
	public static final int OPERATOR_DEST_ATOP = 10;
	/**
	* Source and destination are shown where there is only one of them.
	*/
	public static final int OPERATOR_XOR = 11;
	/**
	* Source and destination layers are accumulated.
	*/
	public static final int OPERATOR_ADD = 12;	
	/**
	* Like over, but assuming source and dest are disjoint geometries
	*/
	public static final int OPERATOR_SATURATE = 13;
	//------------------------------------------------------------ ANTI ALIAS
	public static final int ANTIALIAS_DEFAULT = 0;
	public static final int ANTIALIAS_NONE = 1;
	public static final int ANTIALIAS_GRAY = 2;
	public static final int ANTIALIAS_SUBPIXEL = 3;
	//------------------------------------------------------------ FILL RUKE
	/**
	*If the path crosses the ray from left-to-right, counts +1.
	* If the path crosses the ray from right to left, counts -1.
	* (Left and right are determined from the perspective of looking along the ray from the starting point.) 
	* If the total count is non-zero, the point will be filled.
	*/
	public static final int FILL_RULE_WINDING = 0;
	/**
	*Counts the total number of intersections, without regard to the orientation of the contour.
	*If the total number of intersections is odd, the point will be filled.
	*/
	public static final int FILL_RULE_EVEN_ODD = 1;
	//---------------------------------------------------------- LINE CAP
	/**
	* Start(stop) the line exactly at the start(end) point.
	*/
	public static final int LINE_CAP_BUTT = 0;
	/**
	* Use a round ending, the center of the circle is the end point.
	*/
	public static final int LINE_CAP_ROUND = 1;
	/**
	* Use squared ending, the center of the square is the end point.
	*/
	public static final int LINE_CAP_SQUARE = 2;
	//---------------------------------------------------------- LINE JOIN
	/**
	* Use a sharp (angled) corner, see cairo_set_miter_limit().
	*/
	public static final int LINE_JOIN_MITER = 0;
	/**
	* Use a rounded join, the center of the circle is the joint point.
	*/
	public static final int LINE_JOIN_ROUND = 1;
	/**
	* Use a cut-off join, the join is cut off at half the line width from the joint point.
	*/
	public static final int LINE_JOIN_BEVEL = 2;
	//------------------------------------------------------------ GTK CLIP AREA
	/**
	* GDK clip area.
	*/
	private Rectangle area;


	//------------------------------------------------------------ CONSTRUCTOR
	/**
	* Called by native code.
	*/
	public CairoGraphics( int x, int y, int width, int height )
	{
		this.area = new Rectangle( x, y, width, height );
	}



	//------------------------------------------------------------------------------------- CAIRO METHODS

	//------------------------------------------------------------------------------------- CONTEXT
	/**
	* Checks whether an error has previously occurred for this context.
	*/
	public native int status();
	//cairo_surface_t* get_target();
	/**
	* Sets the source pattern to an opaque color.
	*/
	public void set_source_rgb( CairoColor c )
	{
		set_source_rgb( c.getRed(), c.getGreen(), c.getBlue());
	}
	/**
	* Sets the source pattern to an opaque color. 
	*/
	public native void set_source_rgb(double red, double green, double blue);
	/**
	* Sets the source pattern within to a translucent color.
	*/
	public native void set_source_rgba( double red,double green, double blue, double alpha);
	/**
	* Sets the source pattern. This pattern will then be used for any subsequent drawing operation until a new source pattern is set.
	*/
	public void set_source( CairoPattern pat )
	{
		set_source( pat.get_id() );
	}
	private native void set_source( int pid );
	//public native void set_source_surface( CairoSurface surface, double x, double y);
	//CairoPattern get_source ();
	/**
	* Set the antialiasing mode of the rasterizer used for drawing shapes. 
	* This value is a hint, and a particular backend may or may not support a particular value.
	*/
	public native void set_antialias( int antialias);
	/**
	* Gets the current shape antialiasing mode.
	*/
	public native int get_antialias ();
/*
	public native void                set_dash                      (cairo_t *cr,
                                                         const double *dashes,
                                                         int num_dashes,
                                                         double offset);
int                 get_dash_count                (cairo_t *cr);
	public native void                get_dash                      (cairo_t *cr,
                                                         double *dashes,
                                                         double *offset);
*/
	/**
	* Set the current fill rule within the cairo context.
	* The fill rule is used to determine which regions are inside or outside a complex (potentially self-intersecting) path. 
	*/
	public native void set_fill_rule( int rule );
	/**
	* Gets the current fill rule.
	*/
	public native int get_fill_rule();
	/**
	* Sets the current line cap style within the cairo context. The default line cap style is LINE_CAP_BUTT.
	*/
	public native void set_line_cap( int line_cap );
	/**
	* Gets the current line cap style.
	*/
	public native int get_line_cap();
	/**
	* Sets the current line join style within the cairo context. The default line join style is LINE_JOIN_MITER.
	*/
	public native void set_line_join( int line_join);
	/**
	* Gets the current line join style.
	*/
	public native int get_line_join();
	/**
	* Sets the current line width within the cairo context. 
	* The line width value specifies the diameter of a pen that is circular in user space, 
	* (though device-space pen may be an ellipse in general due to scaling/shear/rotation of the CTM).
	* The default line width value is 2.0.
	*/
	public native void set_line_width( double width );
	/**
	* This function returns the current line width.
	*/
	public native double get_line_width();
	/**
	* Sets the current miter limit within the cairo context.
	*
	*If the current line join style is set to LINE_JOIN_MITER (see set_line_join()), 
	*the miter limit is used to determine whether the lines should be joined with a bevel instead of a miter. 
	*Cairo divides the length of the miter by the line width. If the result is greater than the miter limit, the style is converted to a bevel.
	*<p>
	*The default miter limit value is 10.0, which will convert joins with interior angles 
	*less than 11 degrees to bevels instead of miters. For reference, a miter limit of 2.0 
	*makes the miter cutoff at 60 degrees, and a miter limit of 1.414 makes the cutoff at 90 degrees.
	*<p>
	*A miter limit for a desired angle can be computed as: miter limit = 1/sin(angle/2)
	*/
	public native void set_miter_limit(double limit);
	/**
	* Gets the current miter limit.
	*/
	public native double get_miter_limit();
	/**
	* Sets the compositing operator to be used for all drawing operations. 
	*<p>
	*The default operator is OPERATOR_OVER.
	*The operators marked as unbounded modify their destination even outside of the mask layer 
	*(that is, their effect is not bound by the mask layer). However, their effect can still be limited by way of clipping.
	*<p>
	*To keep things simple, the operator descriptions here document the behavior 
	*for when both source and destination are either fully transparent or 
	*fully opaque. The actual implementation works for translucent layers too. 
	*<p>
	*For a more detailed explanation of the effects of each operator, 
	*including the mathematical definitions, see http://cairographics.org/operators/.
	*/
	public native void set_operator( int operator );
	/**
	* Gets the current compositing operator.
	*/
	public native int get_operator();
	/**
	* Sets the tolerance used when converting paths into trapezoids.
	* Curved segments of the path will be subdivided until the maximum deviation between 
	*the original path and the polygonal approximation is less than tolerance. 
	*The default value is 0.1. A larger value will give better performance, 
	*a smaller value, better appearance. (Reducing the value 
	*from the default value of 0.1 is unlikely to improve appearance significantly.)
	*/
	public native void set_tolerance( double tolerance);
	/**
	* Gets the current tolerance value.
	*/
	public native double get_tolerance();
	/**
	* Establishes a new clip region by intersecting the current clip region with the current path as it 
	* would be filled by cairo_fill() and according to the current fill rule (see cairo_set_fill_rule()).
	*<p>
	* After cairo_clip(), the current path will be cleared from the cairo context.
	*
	*<p> 
	* The current clip region affects all drawing operations by effectively 
	* masking out any changes to the surface that are outside the current clip region.
	*<p>
	* Calling cairo_clip() can only make the clip region smaller, never larger.
	* But the current clip is part of the graphics state, so a temporary 
	* The only means of increasing the size of the clip region is cairo_reset_clip().
	*/
	public native void clip();
	/**
	* Establishes a new clip region by intersecting the current clip region 
	* with the current path as it would be filled by cairo_fill() and according 
	* to the current fill rule (see cairo_set_fill_rule()).
	*<p>
	* Unlike cairo_clip(), cairo_clip_preserve() preserves the path within the cairo context.
	*<p>
	*The current clip region affects all drawing operations by effectively 
	*masking out any changes to the surface that are outside the current clip region.
	*<p>
	*Calling cairo_clip() can only make the clip region smaller, never larger. 
	*The only means of increasing the size of the clip region is cairo_reset_clip().
	*/
	public native void clip_preserve();
	/**
	* Computes a bounding box in user coordinates covering the area inside the current clip.
	*/
	public native CairoRectangle clip_extents();
	/**
	* Reset the current clip region to its original, unrestricted state. 
	* That is, set the clip region to an infinitely large 
	* shape containing the target surface. Equivalently, 
	* if infinity is too hard to grasp, one can imagine the clip 
	* region being reset to the exact bounds of the target surface.
	*/
	public native void reset_clip();
	/**
	* A drawing operator that fills the current path according to the current fill rule, 
	* (each sub-path is implicitly closed before being filled). 
	* After cairo_fill(), the current path will be cleared from the cairo context. 
	* @see set_fill_rule()
	* @see fill_preserve()
	*/
	public native void fill();
	/**
	* A drawing operator that fills the current path according to the current fill rule, 
	* (each sub-path is implicitly closed before being filled). 
	* Unlike cairo_fill(), cairo_fill_preserve() preserves the path within the cairo context.
	*/
	public native void fill_preserve();
	/**
	* Computes a bounding box in user coordinates covering the area that would be affected, (the "inked" area), 
	* by a cairo_fill() operation given the current path and fill parameters.
	*/
	public native CairoRectangle fill_extents();
	/**
	* Tests whether the given point is inside the area that would be 
	* affected by a cairo_fill() operation given the current path and filling parameters
	*/
	public native boolean in_fill( double x, double y);
	/**
	* A drawing operator that paints the current source using the alpha channel of pattern as a mask.
	*/
	public void mask( CairoPattern pat ){ mask( pat.get_id() ); }
	/**
	* A drawing operator that paints the current source using the alpha channel of pattern as a mask.
	*/
	private native void mask(int pid);
	//public native void mask_surface( CairoSurface surface,double surface_x, double surface_y);
	/**
	* A drawing operator that paints the current source everywhere within the current clip region.
	*/
	public native void paint();
	/**
	* A drawing operator that paints the current source everywhere within the current clip region using a mask of constant alpha value alpha.
	*/
	public native void paint_with_alpha( double alpha );
	/**
	* A drawing operator that strokes the current path according to the current line width, line join, line cap, and dash settings. 
	* After stroke(), the current path will be cleared from the cairo context.
	*<p>
	*Note: Degenerate segments and sub-paths are treated specially and provide a useful result. 
	*These can result in two different situations:
	*<p>
	*1. Zero-length "on" segments set in cairo_set_dash(). If the cap style is LINE_CAP_ROUND or LINE_CAP_SQUARE then 
	*these segments will be drawn as circular dots or squares respectively. In the case of 
	*LINE_CAP_SQUARE, the orientation of the squares is determined by the direction of the underlying path.
	*<p>
	*2. A sub-path created by move_to() followed by either a close_path() or one or 
	*more calls to cline_to() to the same coordinate as the cairo_move_to(). 
	*If the cap style is LINE_CAP_ROUND then these sub-paths will be drawn as circular dots. 
	*Note that in the case of LINE_CAP_SQUARE a degenerate sub-path will not be drawn at all, 
	*(since the correct orientation is indeterminate).
	*In no case will a cap style of CAIRO_LINE_CAP_BUTT cause anything 
	*to be drawn in the case of either degenerate segments or sub-paths.
	*/
	public native void stroke();
	/**
	* A drawing operator that strokes the current path according to the current line width, line join, line cap, and dash settings. 
	*Unlike cairo_stroke(), cairo_stroke_preserve() preserves the path within the cairo context.
	*/
	public native void stroke_preserve();
	/**
	* Computes a bounding box in user coordinates covering 
	* the area that would be affected, (the "inked" area), by a 
	* stroke() operation operation given the current path and stroke parameters. 
	*/
	public native CairoRectangle stroke_extents();
	/**
	* Tests whether the given point is inside the area that would be affected by a 
	* stroke() operation given the current path and stroking paramet
	*/
	public native boolean in_stroke( double x, double y);




	//----------------------------------------------------------------------- Transformations
	/**
	* Modifies the current transformation matrix (CTM) by translating the user-space origin by (tx, ty). 
	* This offset is interpreted as a user-space coordinate according 
	* to the CTM in place before the new call to cairo_translate().
	* In other words, the translation of the user-space origin takes place after any existing transformation.
	*/
	public native void translate(double tx,double ty);
	/**
	* Modifies the current transformation matrix (CTM) by scaling the X and Y user-space axes by sx and sy respectively. 
	* The scaling of the axes takes place after any existing transformation of user space.
	*/
	public native void scale(double sx, double sy);
	/**
	* Modifies the current transformation matrix (CTM) by rotating the user-space axes by angle radians.
	* The rotation of the axes takes places after any existing transformation of user space. 
	* The rotation direction for positive angles is from the positive X axis toward the positive Y axis.
	*/
	public native void rotate(double angle);
	/**
	* Modifies the current transformation matrix (CTM) by applying matrix as an additional transformation. 
	* The new transformation of user space takes place after any existing transformation.
	*/
	public native void transform( CairoMatrix matrix);
	/**
	* Modifies the current transformation matrix (CTM) by setting it equal to matrix.
	*/
	public native void set_matrix( CairoMatrix matrix);
	/**
	* Stores the current transformation matrix (CTM) into matrix.
	*/
	public native CairoMatrix get_matrix();
	/**
	* Resets the current transformation matrix (CTM) by setting it equal to the identity matrix. 
	* That is, the user-space and device-space axes will be aligned and one user-space unit will transform to one device-space unit.
	*/
	public native void identity_matrix();
	/**
	* Same as identity_matrix().
	*/
	public native void reset_matrix();//==identity matrix
	/**
	* Transform a coordinate from user space to device space by multiplying the given point by the current transformation matrix (CTM).
	*/
	public native CairoPoint user_to_device( double x, double y );
	/**
	* Transform a distance vector from user space to device space. 
	* This function is similar to cairo_user_to_device() except that the 
	* translation components of the CTM will be ignored when transforming (dx,dy)
	*/
	public native CairoPoint user_to_device_distance( double x, double y );
	/**
	* Transform a coordinate from device space to user space by 
	* multiplying the given point by the inverse of the current transformation matrix (CTM).
	*/
	public native CairoPoint device_to_user( double x, double y );
	/**
	* Transform a distance vector from device space to user space. 
	* This function is similar to cairo_device_to_user() except that the 
	* translation components of the inverse CTM will be ignored when transforming (dx,dy).
	*/
	public native CairoPoint device_to_user_distance(double x, double y );

	//--------------------------------------------------------------------- PATH
	/**
	* Clears the current path. After this call there will be no path and no current point.
	*/
	public native void new_path();

	/**
	*Begin a new sub-path. Note that the existing path is not affected. After this call there will be no current point.
	* In many cases, this call is not needed since new sub-paths are frequently started with cairo_move_to().
	* A call to cairo_new_sub_path() is particularly useful when beginning a
	* new sub-path with one of the cairo_arc() calls. This makes things easier 
	* as it is no longer necessary to manually compute the arc's initial coordinates for a call to cairo_move_to().
	*/
	public native void new_sub_path();

	/**
	* Adds a line segment to the path from the current point to the beginning of the current sub-path,
	* (the most recent point passed to cairo_move_to()), and closes this sub-path.
	* After this call the current point will be at the joined endpoint of the sub-path.
	* The behavior of cairo_close_path() is distinct from simply calling cairo_line_to() 
	* with the equivalent coordinate in the case of stroking. When a closed sub-path is stroked, 
	* there are no caps on the ends of the sub-path. 
	* Instead, there is a line join connecting the final and initial segments of the sub-path.
	* If there is no current point before the call to cairo_close_path(), this function will have no effect.
	*/
	public native void close_path();

	/**
	* Adds a circular arc of the given radius to the current path. 
	* The arc is centered at (xc, yc), begins at angle1 and proceeds in the 
	* direction of increasing angles to end at angle2. If angle2 is less than angle1 it 
	* will be progressively increased by 2*M_PI until it is greater than angle1.
	* <p>
	* If there is a current point, an initial line segment will be added to the path 
	* to connect the current point to the beginning of the arc. If this initial line 
	* is undesired, it can be avoided by calling cairo_new_sub_path() before calling cairo_arc().
	* <p>
	* Angles are measured in radians. An angle of 0.0 is in the direction 
	* of the positive X axis (in user space). An angle of M_PI/2.0 radians (90 degrees)
	*  is in the direction of the positive Y axis (in user space).
	*  Angles increase in the direction from the positive X axis toward the positive Y axis. 
	* So with the default transformation matrix, angles  increase in a clockwise direction.
	* <p>
	* To convert from degrees to radians, use degrees * (M_PI / 180).
	* <p>
	* This function gives the arc in the direction of increasing angles.
	* The arc is circular in user space. To achieve an elliptical arc, 
	* you can scale the current transformation matrix by different amounts in the X and Y directions.
	*/
	public native void arc( double xc, double yc, double radius, double angle1, double angle2);

	/**
	* This function gives the arc in the direction of decreasing angles.
	*/
	public native void arc_negative( double xc, double yc,double radius, double angle1, double angle2);

	/**
	* Adds a cubic Bézier spline to the path from the current point to position (x3, y3)
	* in user-space coordinates, using (x1, y1) and (x2, y2) as the control points.
	*/
	public native void curve_to( double x1, double y1, double x2, double y2, double x3, double y3);

	/**
	* Begin a new sub-path. After this call the current point will be (x, y).
	*/
	public native void move_to( double x, double y);

	/**
	* Adds a line to the path from the current point to position (x, y) in user-space coordinates.
	* After this call the current point will be (x, y).
	*/
	public native void line_to( double x, double y);

	/**
	* Adds a closed sub-path rectangle of the given size to the current path at position (x, y) in user-space coordinates.
	*/
	public native void rectangle( double x, double y, double width, double height);

	/**
	* Adds closed paths for text to the current path. The generated path if filled
	*/
	public native void text_path( String text );

	/**
	* Relative-coordinate version of curve_to().
	* <p>
	* Given a current point of (x, y), rel_curve_to(dx1, dy1, dx2, dy2, dx3, dy3) 
	* is logically equivalent to curve_to( x+dx1, y+dy1, x+dx2, y+dy2, x+dx3, y+dy3).
	* <p>
	* It is an error to call this function with no current point. 
	*/
	public native void rel_curve_to( double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);

	/**
	* Relative-coordinate version of line_to().
	* <p>
	* Given a current point of (x, y), cairo_rel_line_to(cr, dx, dy) is logically equivalent to cairo_line_to(cr, x + dx, y + dy).
	* It is an error to call this function with no current point.
	*/
	public native void rel_line_to( double dx, double dy);

	/**
	* Begin a new sub-path. After this call the current point will offset by (x, y).
	* <p>
	* Given a current point of (x, y), rel_move_to(cr, dx, dy) is logically equivalent to move_to(cr, x + dx, y + dy).
	* <p>
	* It is an error to call this function with no current point.
	*/
	public native void rel_move_to( double dx, double dy);

	/**
	* Computes a bounding box in user-space coordinates covering the points on the current path. 
	* If the current path is empty, returns an empty rectangle ((0,0), (0,0)). Stroke parameters, 
	* fill rule, surface dimensions and clipping are not taken into account.
	* <p>
	* Contrast with fill_extents() and stroke_extents() which return the extents 
	* of only the area that would be "inked" by the corresponding drawing operations.
	*/
	public native Rectangle2D.Double path_extents();
 
	/**
	* Draws a test image.
	*/
	public native void testDraw();

}//end class